<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="任务列表.css">
</head>

<body>
    <div id="app">
        <div class="title">
            <h3>任务列表</h3>
            <span>每完成一个任务,即可获得<span class="number">10MB~1GB</span> 流量哦!
            </span>
        </div>
        <div class="list" >
         <!-- 列表渲染, v-for="(item,index) in tasklist" -->
          <!-- 属性值的绑定属性名称前必须有v-bind: 否则属性值无法正常解析 -->
          <!-- key的作用可以理解为存放一个区分每个item的变量， -->
            <div class="item" v-for="(item,index) in tasklist" v-bind:key = "index">
                <div class="left">
                    <img v-bind:src="item.pic" alt="">
                    <div class="content">
                         <!-- {{ 表达式 或 变量 }} 会解析/计算内部表达式或变量的值  , 只能用在标签的内容区-->
                        <div class="name">{{ item.name }}</div>
                        <div class="information">{{ item.information }}</div>
                    </div>
                </div>
                <div class="right">
                    <button>{{item.status==1?'去完成':(item.status==2?'领取':'已领取')}}</button>
                </div>
            </div>
        </div>
    </div>
</body>

</html>
<script src="./vue-2.5.21.js"></script>
<script>
     //实例化Vue对象
    var v = new Vue({
        //Vue实例挂载的dom节点
        el: '#app',
        data: {
            tasklist: [
                { id: 1, pic: './images/01.gif', name: '咪咕视频送流量', information: '来咪咕视频,每月领500MB流量奖励', status: 1 },
                { id: 2, pic: './images/02.gif', name: '和彩云送福利', information: '免费领100G空间+月月2GB', status: 2 },
                { id: 3, pic: './images/03.gif', name: '最高40元套餐折扣券', information: '参与抽奖,奖励10MB,经验值+10', status: 3 },
                { id: 4, pic: './images/04.gif', name: '吃喝玩乐季,超级秒杀', information: '进入隐藏二楼参与秒杀,奖励10MB,经验值+10', status: 3 },
            ]
        }
    })
</script>